<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>伪类</title>
    <style>
      body {
        background-color: #2c3e50;
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
      }

      .slide-bar {
        position: relative;
        color: transparent;
        animation: fill-text-white 2s 1.6s forwards;
      }

      .slide-bar::before {
        position: absolute;
        content: "";
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: #35b9f1;
        transform: scaleX(0);
        transform-origin: left;
        animation: slide-in-out 2s cubic-bezier(0.75, 0, 0, 1) forwards;
      }

      @keyframes slide-in-out {
        50% {
          transform: scaleX(1);
          transform-origin: left;
        }

        50.1% {
          transform-origin: right;
        }

        100% {
          transform: scaleX(0);
          transform-origin: right;
        }
      }

      @keyframes fill-text-white {
        to {
          color: white;
        }
      }

      .title,
      .subtitle {
        width: 250px;
        height: 30px;
      }

      .title {
        margin: 0;
        font-size: 32px;
        line-height: 30px;
      }
      .title::before {
        background: #ff4081;
      }

      .subtitle {
        margin: 10px 0 0 0;
        font-size: 12px;
        line-height: 30px;
        letter-spacing: 5px;
        text-transform: uppercase;
        animation-delay: 3.2s;
      }
      .subtitle::before {
        background: #03a9f4;
        animation-delay: 2s;
      }
    </style>
  </head>
  <body>
    <header>
      <h1 class="title slide-bar">I'm xiaobaicai.</h1>
      <p class="subtitle slide-bar">A CSS Wizard</p>
    </header>
  </body>
</html>
